import 'package:jet_rails/jr_app/jr_models/jr_comment_model.dart';
import 'package:jet_rails/jr_app/jr_models/jr_user_model.dart';
import 'package:json_annotation/json_annotation.dart';

part 'jr_article_model.g.dart';

@JsonSerializable()
class JrArticleModel {
  String authorCode;
  JrUserModel? author;
  int followed;
  int count;
  String title;
  String? thumbnail;
  @JsonKey(name: 'content', defaultValue: [])
  List<String> content;
  String description;
  String? avatar;
  bool? likedByMe;
  @JsonKey(name: 'commentList', defaultValue: [])
  List<JrCommentModel> commentList;

  JrArticleModel(
      {required this.title,
      required this.description,
      required this.authorCode,
      required this.followed,
      required this.count,
      required this.thumbnail,
      required this.content,
      this.author,
      required this.commentList,
      this.likedByMe,
      this.avatar});

  factory JrArticleModel.fromJson(Map<String, dynamic> json) => _$JrArticleModelFromJson(json);

  Map<String, dynamic> toJson() => _$JrArticleModelToJson(this);
}
